“h5_crtgrp18”

Information

The example shown in this file appears at: http://www.hdfgroup.org/HDF5/Tutor/crtgrp.html (accessed 10 July 2011)

The example shown in this file is following the tutorial: http://www.hdfgroup.org/HDF5/Tutor/introductory.html

Good references for the shown HDF5 functions include:
http://www.hdfgroup.org/HDF5/doc/RM/RM_H5Front.html
http://www.hdfgroup.org/HDF5/doc/RM/

Prepared 10 July 2011 by Scot Martin for Windows 7, 64-bit, Mathematica version 8.0.1.

“c” code we seek to replicate in this example

/*
 *    Creating and closing a group.
 */

#include "hdf5.h"
#define FILE "group.h5"

int main() {

   hid_t       file_id, group_id;  /* identifiers */
   herr_t      status;

   /* Create a new file using default properties. */
   file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);

   /* Create a group named "/MyGroup" in the file. */
   group_id = H5Gcreate(file_id, "/MyGroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);

   /* Close the group. */
   status = H5Gclose(group_id);

   /* Terminate access to the file. */
   status = H5Fclose(file_id);
}

Implementation in Mathematica

SetDirectory[NotebookDirectory[]]

Needs["HDF5`"]

file=FileNameJoin[{Directory[],"group.h5"}]

fileID=H5Fcreate[file,H5FuACCuTRUNC,H5PuDEFAULT,H5PuDEFAULT]

groupID=H5Gcreate[fileID, "/MyGroup", H5PuDEFAULT,H5PuDEFAULT,H5PuDEFAULT]

H5Gclose[groupID]

H5Fclose[fileID]